func void ZS_Stand_WP()
{
	B_NoDynCol(self);
	if(!self.aivar[AIV_TELEPORTED]||Npc_GetDistToWp(self, self.wp)>80)
	{
		self.aivar[AIV_TELEPORTED] = 1;
		AI_Teleport(self, self.wp);
	};
	B_NoDynCol(self);
	
	Perception_Set_Normal();

	B_ResetAll (self);

	AI_SetWalkmode (self, NPC_RUN);

	AI_GotoWP		(self, self.wp);
	AI_AlignToWP	(self);

	self.aivar[AIV_TAPOSITION] = NOTINPOS;
};

func int ZS_Stand_WP_loop()
{
	if (self.aivar[AIV_OpSelected] == FALSE)
	{
		AI_RemoveWeapon(self);
		AI_UnreadySpell(self);
	}	
	else
	{
		if (self.aivar[AIV_MagicUser] == MAGIC_ALWAYS) 
		{
			if (Hlp_StrCmp(self.name,"Xardas")) { 
				B_ReadySpell (self, SPL_BreathOfDeath,	SPL_Cost_InstantFireball);
			}
			else if (Hlp_StrCmp(self.name,"Y'Berion")) { 
				B_ReadySpell (self, SPL_Windfist,		SPL_Cost_InstantFireball);
			}
			else {
				B_ReadySpell (self, SPL_InstantFireball,SPL_Cost_InstantFireball);
			};
		}
		else {
			if (Npc_HasEquippedRangedWeapon(self)) {
				AI_ReadyRangedWeapon(self);
			}
			else {
				AI_ReadyMeleeWeapon(self);
			};
		};
	};	
	return LOOP_CONTINUE;
};

func void ZS_Stand_WP_end()
{
};
